﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterAdmin.master" AutoEventWireup="true" CodeBehind="Ordering.aspx.cs" Inherits="Project_Udrinkwater.Stock.Ordering" %>
<%@ Register TagPrefix="dxe" Namespace="DevExpress.Web.ASPxEditors" Assembly="DevExpress.Web.v12.2, Version=12.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
    // <![CDATA[
        var postponedCallbackRequired = false;
        function OnListBoxIndexChanged(s, e) {
            if (CallbackPanel.InCallback())
                postponedCallbackRequired = true;
            else
                CallbackPanel.PerformCallback();
        }
     
        
        function ShowLoginWindow() {
            pcLogin.Show();
        }
        function ShowCreateAccountWindow() {
            pcCreateAccount.Show();
            tbUsername.Focus();
        }

        var lastCountry = null;
        var Bestlast = null;
        function OnCountryChanged(cmbCountry) {
            if (cmbCity.InCallback())
                lastCountry = cmbCountry.GetValue().toString();
            else
                cmbCity.PerformCallback(cmbCountry.GetValue().toString());
        }
        function OnEndCallback(s, e) {
            if (lastCountry) {
                cmbCity.PerformCallback(lastCountry);
                lastCountry = null;
            }
        }


        function OnCountry2Changed(cmbCountry) {
            if (cmbPrice.InCallback())
                Bestlast = cmbCountry.GetValue().toString();
            else
                cmbPrice.PerformCallback(cmbCountry.GetValue().toString());
        }
        
        function OnEndCallback2(s, e) {
            if (Bestlast) {
                cmbPrice.PerformCallback(Bestlast);
                Bestlast = null;
            }
        } 
        
    // ]]> 
    </script>

    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>

    <dx:ASPxGridViewExporter ID="gridExport" runat="server" 
        GridViewID="ASPxGridView1">
        <Styles>
            <Default Font-Names="Angsana New">
            </Default>
        </Styles>
    </dx:ASPxGridViewExporter>
    <dx:ASPxGridViewExporter ID="gridExport2" runat="server" GridViewID="grid" 
        PaperKind="A4">
        <Styles>
            <Default Font-Names="Angsana New">
            </Default>
            <Header VerticalAlign="Middle">
                <Paddings PaddingBottom="5px" PaddingLeft="7px" PaddingRight="7px" 
                    PaddingTop="5px" />
            </Header>
        </Styles>
    </dx:ASPxGridViewExporter>

    <asp:Panel ID="Panel1" runat="server">
        <fieldset>
        <legend>การขาย</legend>
         
                <asp:Panel ID="Panel4" runat="server">
                    <asp:Panel ID="Panel6" runat="server">
                        <table style="width: 100%">
                            <tr>
                                <td align="right">
                                    <table style="width: 100%">
                                        <tr>
                                            <td align="right" style="width: 315px">
                                                <dxe:ASPxLabel ID="ASPxLabel3" runat="server" Text="ค้นหาตั้งแต่วันที่:">
                                                </dxe:ASPxLabel>
                                            </td>
                                            <td style="width: 210px">
                                                <dxe:ASPxDateEdit ID="deStart0" runat="server" DisplayFormatString="dd/MM/yyyy" 
                                                    EditFormat="Custom" EditFormatString="dd/MM/yyyy">
                                                </dxe:ASPxDateEdit>
                                            </td>
                                            <td align="right" style="width: 108px">
                                                <dxe:ASPxLabel ID="ASPxLabel4" runat="server" Text="ถึงวันที่:">
                                                </dxe:ASPxLabel>
                                            </td>
                                            <td style="width: 198px">
                                                <dxe:ASPxDateEdit ID="edEnd0" runat="server" DisplayFormatString="dd/MM/yyyy" 
                                                    EditFormat="Custom" EditFormatString="dd/MM/yyyy">
                                                </dxe:ASPxDateEdit>
                                            </td>
                                            <td>
                                                <dxe:ASPxButton ID="ASPxButton8" runat="server" onclick="ASPxButton8_Click" 
                                                    Text="ค้นหา">
                                                </dxe:ASPxButton>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                    <table style="width: 100%">
                        <tr>
                            <td style="width: 145px">
                                <dx:ASPxButton ID="btnPdfExport" runat="server" OnClick="btnPdfExport_Click" 
                                    Text="พิมพ์รายงาน PDF" UseSubmitBehavior="False" Width="150px" />
                            </td>
                            <td>
                                <dx:ASPxButton ID="btnXlsExport" runat="server" OnClick="btnXlsExport_Click" 
                                    Text="พิมรายงาน XLS" UseSubmitBehavior="False" Width="150px" />
                            </td>
                            <td>
                                <dx:ASPxButton ID="btnXlsxExport" runat="server" OnClick="btnXlsxExport_Click" 
                                    Text="Export to XLSX" UseSubmitBehavior="False" Visible="False" />
                            </td>
                            <td>
                                <dx:ASPxButton ID="btnRtfExport" runat="server" OnClick="btnRtfExport_Click" 
                                    Text="Export to RTF" UseSubmitBehavior="False" Visible="False" />
                            </td>
                            <td>
                                <dx:ASPxButton ID="btnCsvExport" runat="server" OnClick="btnCsvExport_Click" 
                                    Text="Export to CSV" UseSubmitBehavior="False" Visible="False" />
                            </td>
                            <td align="right">
                                <dxe:ASPxButton ID="ASPxButton6" runat="server" onclick="ASPxButton6_Click" 
                                    Text="ค้นหารายการขายแต่ละวัน" Width="180px">
                                </dxe:ASPxButton>
                            </td>
                            <td align="right">
                                <dxe:ASPxButton ID="btShowAllOrder" runat="server" 
                                    onclick="btShowAllOrder_Click" Text="แสดงรายการทั้งหมด" Width="150px">
                                </dxe:ASPxButton>
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            
        <dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" 
                DataSourceID="SqlOrder" KeyFieldName="Order_ID" Width="100%">
            <Columns>
                <dx:GridViewCommandColumn Caption="แก้ไข/เพิ่ม/ลบ" VisibleIndex="7">
                    <EditButton Text="แก้ไข" Visible="True">
                    </EditButton>
                    <NewButton Text="เพิ่ม" Visible="True">
                    </NewButton>
                    <DeleteButton Text="ลบ" Visible="True">
                    </DeleteButton>
                    <ClearFilterButton Visible="True">
                    </ClearFilterButton>
                </dx:GridViewCommandColumn>
                <dx:GridViewDataTextColumn FieldName="Order_ID" ReadOnly="True" Visible="False" 
                        VisibleIndex="0">
                    <EditFormSettings Visible="False" />
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn Caption="เลขที่เอกสาร" FieldName="Order_doc_NO" 
                        ReadOnly="True" VisibleIndex="1" Width="150px">
                    <EditFormSettings Visible="False" />
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataDateColumn Caption="วันที่ทำรายการ" FieldName="Order_Date_Time" 
                        VisibleIndex="2" Width="100px">
                    <PropertiesDateEdit DisplayFormatString="dd/MM/yyyy">
                    </PropertiesDateEdit>
                </dx:GridViewDataDateColumn>
                <dx:GridViewDataTextColumn Caption="เครดิต" FieldName="Credit" VisibleIndex="3" 
                        Width="50px" Visible="False">
                    <EditFormSettings Visible="False" />
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataDateColumn Caption="วันกำหนดส่ง" FieldName="Deadlines_Date" 
                        VisibleIndex="4" Width="100px">
                    <PropertiesDateEdit DisplayFormatString="dd/MM/yyyy">
                    </PropertiesDateEdit>
                </dx:GridViewDataDateColumn>
                <dx:GridViewDataComboBoxColumn Caption="พนักงานทำรายการ" FieldName="Employee_ID" 
                        VisibleIndex="5" Width="200px">
                    <PropertiesComboBox CallbackPageSize="30" DataSourceID="SqlEmp" 
                            EnableCallbackMode="True" IncrementalFilteringMode="Contains" 
                            TextFormatString="{0} ({1})" ValueField="Employee_ID">
                        <Columns>
                            <dxe:ListBoxColumn Caption="ชื่อ" FieldName="Name" />
                            <dxe:ListBoxColumn Caption="รหัสพนักงาน" FieldName="Employee_ID" />
                            <dxe:ListBoxColumn Caption="แผนก" FieldName="Department_Name" />
                        </Columns>
                    </PropertiesComboBox>
                </dx:GridViewDataComboBoxColumn>
                <dx:GridViewDataComboBoxColumn Caption="ชื่อลูกค้า" 
                        FieldName="Customer_ID" VisibleIndex="6" Width="200px">
                    <PropertiesComboBox DataSourceID="SqlCustomer" EnableCallbackMode="True" 
                            IncrementalFilteringMode="Contains" TextFormatString="{0} ({1})" 
                            ValueField="Customer_ID">
                        <Columns>
                            <dxe:ListBoxColumn Caption="ชื่อ" FieldName="Name" />
                            <dxe:ListBoxColumn Caption="รหัสลูกค้า" FieldName="Customer_ID" />
                        </Columns>
                    </PropertiesComboBox>
                </dx:GridViewDataComboBoxColumn>
                <dx:GridViewDataTextColumn Caption="สร้างรายการ" VisibleIndex="9">
                    <EditFormSettings Visible="False" />
                    <DataItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server"   
                                CommandArgument='<%# Eval("Order_ID") %>' ToolTip="ดูรายการของเอกสารรหัสนี้"  
                                oncommand="LinkButton1_Command">ดูและสร้างรายการ</asp:LinkButton>
                    </DataItemTemplate>
                </dx:GridViewDataTextColumn>
            </Columns>
            <Settings ShowFilterRow="True" />
            <SettingsText GroupPanel="ลากคอลัมวางที่นี่เพื่อจัดเรียงตามคอลัม" />
        </dx:ASPxGridView>
        </fieldset>
    </asp:Panel>
    <asp:SqlDataSource ID="SqlOrder" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DB_UdrinkConnectionString %>" 
        
        SelectCommand="SELECT Order_ID, Order_doc_NO, Order_Date_Time, Credit, Deadlines_Date, Employee_ID, Customer_ID FROM TB_Order WHERE Order_Date_Time BETWEEN @sStart AND @sEnd  ORDER BY Order_ID DESC" 
        DeleteCommand="DELETE FROM TB_Order WHERE (Order_ID = @Order_ID)" 
        InsertCommand="INSERT INTO TB_Order(Order_Date_Time, Credit, Deadlines_Date, Employee_ID, Customer_ID) VALUES (@Order_Date_Time, @Credit, @Deadlines_Date, @Employee_ID, @Customer_ID)" 
        
        
        
        
        UpdateCommand="UPDATE TB_Order SET Order_Date_Time = @Order_Date_Time  , Credit = @Credit , Deadlines_Date = @Deadlines_Date  , Employee_ID = @Employee_ID , Customer_ID = @Customer_ID   WHERE (Order_ID = @Order_ID)" 
        onselecting="SqlOrder_Selecting">
        <DeleteParameters>
            <asp:Parameter Name="Order_ID" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="Order_Date_Time" />
            <asp:Parameter Name="Credit" />
            <asp:Parameter Name="Deadlines_Date" />
            <asp:Parameter Name="Employee_ID" />
            <asp:Parameter Name="Customer_ID" />
        </InsertParameters>
        <SelectParameters>
            <asp:SessionParameter Name="sStart" SessionField="sStart" />
            <asp:SessionParameter DefaultValue="" Name="sEnd" SessionField="sEnd" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="Order_Date_Time" />
            <asp:Parameter Name="Credit" />
            <asp:Parameter Name="Deadlines_Date" />
            <asp:Parameter Name="Employee_ID" />
            <asp:Parameter Name="Customer_ID" />
            <asp:Parameter Name="Order_ID" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlPrice" runat="server" 
    ConnectionString="<%$ ConnectionStrings:DB_UdrinkConnectionString %>" 
    SelectCommand="SELECT TB_Product.Price_A1 FROM TB_Order_List INNER JOIN TB_Product ON TB_Order_List.Product_ID = TB_Product.Product_ID WHERE (TB_Order_List.Order_Category_ID = 1)">
</asp:SqlDataSource>
    
    <asp:Panel ID="Panel2" runat="server" Visible="False">
     <fieldset>
         <asp:Panel ID="Panel7" runat="server">
             <dxe:ASPxButton ID="btback" runat="server" onclick="btback_Click" 
                 Text="กลับตารางหลัก">
             </dxe:ASPxButton>
    </asp:Panel>
     <legend>ค้นหารายการขาย</legend>
         <asp:Panel ID="Panel5" runat="server">
             <table style="width: 100%">
                 <tr>
                     <td align="right" style="width: 315px">
                         <dxe:ASPxLabel ID="ASPxLabel2" runat="server" Text="ค้นหาตั้งแต่วันที่:">
                         </dxe:ASPxLabel>
                     </td>
                     <td style="width: 210px">
                         <dxe:ASPxDateEdit ID="deStart" runat="server" 
                             DisplayFormatString="dd MMMM yyyy" EditFormat="Custom" 
                             EditFormatString="dd/MM/yyyy">
                         </dxe:ASPxDateEdit>
                     </td>
                     <td align="right" style="width: 108px">
                         <dxe:ASPxLabel ID="ASPxLabel1" runat="server" Text="ถึงวันที่:">
                         </dxe:ASPxLabel>
                     </td>
                     <td style="width: 198px">
                         <dxe:ASPxDateEdit ID="edEnd" runat="server" DisplayFormatString="dd MMMM yyyy" 
                             EditFormat="Custom" EditFormatString="dd/MM/yyyy">
                         </dxe:ASPxDateEdit>
                     </td>
                     <td>
                         <dxe:ASPxButton ID="ASPxButton7" runat="server" onclick="ASPxButton7_Click" 
                             Text="ค้นหา">
                         </dxe:ASPxButton>
                     </td>
                 </tr>
             </table>
         </asp:Panel>
             <asp:Panel ID="Panel3" runat="server" Visible="False">
                 <table style="width: 100%">
                     <tr>
                         <td style="width: 102px">
                             <dxe:ASPxButton ID="ASPxButton1" runat="server" onclick="ASPxButton1_Click" 
                                 Text="พิมพ์รายงาน PDF" UseSubmitBehavior="False" Width="150px">
                             </dxe:ASPxButton>
                         </td>
                         <td>
                             <dxe:ASPxButton ID="ASPxButton2" runat="server" onclick="ASPxButton2_Click" 
                                 Text="พิมพ์รายงาน XLS" UseSubmitBehavior="False" Width="110px" 
                                 Visible="False">
                             </dxe:ASPxButton>
                         </td>
                         <td>
                             <dxe:ASPxButton ID="ASPxButton3" runat="server" onclick="ASPxButton3_Click" 
                                 Text="ASPxButton" UseSubmitBehavior="False" Visible="False">
                             </dxe:ASPxButton>
                         </td>
                         <td>
                             <dxe:ASPxButton ID="ASPxButton4" runat="server" onclick="ASPxButton4_Click" 
                                 Text="ASPxButton" UseSubmitBehavior="False" Visible="False">
                             </dxe:ASPxButton>
                         </td>
                         <td style="width: 156px">
                             <dxe:ASPxButton ID="ASPxButton5" runat="server" onclick="ASPxButton5_Click" 
                                 Text="ASPxButton" UseSubmitBehavior="False" Visible="False">
                             </dxe:ASPxButton>
                         </td>
                         <td align="right">
                             <dxe:ASPxButton ID="ASPxButton9" runat="server" onclick="ASPxButton9_Click" 
                                 Text="แสดงรายการทั้งหมด" Width="150px">
                             </dxe:ASPxButton>
                         </td>
                     </tr>
                 </table>
             </asp:Panel>
        
    
        <dx:ASPxGridView ID="grid" runat="server" AutoGenerateColumns="False" 
                            ClientInstanceName="grid" 
    DataSourceID="SqlOderListSert" KeyFieldName="id" 
                            
        onbeforeperformdataselect="ASPxGridView2_BeforePerformDataSelect" Width="100%" 
            Visible="False">
            <Columns>
                <dx:GridViewCommandColumn Visible="False" VisibleIndex="0">
                    <ClearFilterButton Visible="True">
                    </ClearFilterButton>
                </dx:GridViewCommandColumn>
                <dx:GridViewDataTextColumn FieldName="Order_doc_NO" ReadOnly="True" 
                                    VisibleIndex="3" Caption="เลขที่เอกสาร" Width="150px">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataDateColumn FieldName="Order_Date_Time" VisibleIndex="4" 
                    Caption="วันที่เอกสาร" Width="100px">
                    <PropertiesDateEdit DisplayFormatString="dd/MM/yyyy" EditFormat="Custom" 
                        EditFormatString="dd/MM/yyyy">
                    </PropertiesDateEdit>
                </dx:GridViewDataDateColumn>
                <dx:GridViewDataTextColumn FieldName="Row" 
                                    ReadOnly="True" VisibleIndex="1" Caption="ลำดับ">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="id" ReadOnly="True" Visible="False" 
                                    VisibleIndex="2">
                    <EditFormSettings Visible="False" />
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataComboBoxColumn FieldName="Order_Category_ID" VisibleIndex="6" 
                    Caption="ประเภทสินค้า" Width="100px">
                    <PropertiesComboBox DataSourceID="sqlOrderCateory" 
                        TextField="Order_Category_Name" ValueField="Order_Category_ID">
                    </PropertiesComboBox>
                </dx:GridViewDataComboBoxColumn>
                <dx:GridViewDataComboBoxColumn FieldName="Product_ID" VisibleIndex="5" 
                    Caption="สินค้า">
                    <PropertiesComboBox DataSourceID="SqlProductAll" TextField="Product_Name" 
                        ValueField="Product_ID">
                    </PropertiesComboBox>
                </dx:GridViewDataComboBoxColumn>
                <dx:GridViewDataTextColumn FieldName="Price_Unit" VisibleIndex="7" 
                    Caption="ราคา/หน่วย">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="Amount" VisibleIndex="8" Caption="จำนวน">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="Discount" VisibleIndex="9" 
                    Caption="ส่วนลด">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="Total" ReadOnly="True" VisibleIndex="10" 
                    Caption="รวม">
                </dx:GridViewDataTextColumn>
            </Columns>
            <SettingsPager Mode="ShowAllRecords">
            </SettingsPager>
            <SettingsEditing Mode="EditForm" />
            <Settings ShowFilterRow="True" ShowFooter="True" />
            <TotalSummary>
                <dx:ASPxSummaryItem DisplayFormat="รวม {0:#,###.00}" FieldName="Total" 
                                    ShowInColumn="Total" ShowInGroupFooterColumn="Total" 
                SummaryType="Sum" />
            </TotalSummary>
            <SettingsText GroupPanel="ลากคอลัมวางที่นี่เพื่อจัดเรียงตามคอลัม" />
        </dx:ASPxGridView>
        </fieldset>
    </asp:Panel>
    <asp:SqlDataSource ID="SqlEmp" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DB_UdrinkConnectionString %>" 
        SelectCommand="SELECT TB_Employee.Employee_ID, TB_Employee.FirstName + ' ' + TB_Employee.LastName AS Name, TB_Department.Department_Name FROM TB_Employee INNER JOIN TB_Department ON TB_Employee.Departmernt_ID = TB_Department.Department_ID">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlCustomer" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DB_UdrinkConnectionString %>" 
        SelectCommand="SELECT  Firstname  +'  '+ Lastname AS Name ,Customer_ID FROM TB_Customer">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlOderListSert" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DB_UdrinkConnectionString %>" 
        DeleteCommand="DELETE FROM TB_Order_List WHERE (id = @id)" 
        InsertCommand="INSERT INTO TB_Order_List(Order_ID, Order_Category_ID, Product_ID, Amount, Price_Unit, Discount) VALUES (@Order_ID, @Order_Category_ID, @Product_ID, @Amount, @Price_Unit, @Discount);" 
        
        
        SelectCommand="SELECT TB_Order.Order_doc_NO,TB_Order.Order_Date_Time ,ROW_NUMBER() OVER (ORDER BY TB_Order.Order_ID DESC) AS Row, TB_Order_List.id, TB_Order_List.Order_Category_ID, TB_Order_List.Product_ID, TB_Order_List.Price_Unit, TB_Order_List.Amount, TB_Order_List.Discount, (TB_Order_List.Price_Unit * TB_Order_List.Amount - TB_Order_List.Discount) AS Total FROM TB_Order INNER JOIN TB_Order_List ON TB_Order.Order_ID = TB_Order_List.Order_ID INNER JOIN TB_Order_Category ON TB_Order_List.Order_Category_ID = TB_Order_Category.Order_Category_ID WHERE TB_Order.Order_Date_Time BETWEEN @sStart AND @sEnd " 
        
        
        
        
        
        
        
        
        
        
        
        UpdateCommand="UPDATE TB_Order_List SET Order_Category_ID = @Order_Category_ID, Product_ID = @Product_ID, Amount = @Amount WHERE id=@id" 
        onselecting="SqlOderListSert_Selecting">
        <DeleteParameters>
            <asp:Parameter Name="id" />
        </DeleteParameters>
        <InsertParameters>
            <asp:SessionParameter Name="Order_ID" SessionField="Order_ID" />
            <asp:Parameter Name="Order_Category_ID" />
            <asp:Parameter Name="Product_ID" />
            <asp:Parameter Name="Amount" />
            <asp:Parameter Name="Price_Unit" />
            <asp:Parameter Name="Discount" />
          
        </InsertParameters>
        <SelectParameters>
            <asp:SessionParameter DefaultValue="" Name="sStart" SessionField="sStart" />
            <asp:SessionParameter DefaultValue="" Name="sEnd" SessionField="sEnd" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="Order_Category_ID" />
            <asp:Parameter Name="Product_ID" />
            <asp:Parameter Name="Amount" />
            <asp:Parameter Name="id" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="AccessDataSourceCountry" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DB_UdrinkConnectionString %>" 
        
        
        
        SelectCommand="SELECT Product_ID, Product_Name FROM TB_Product">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="AccessDataSourceCities" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DB_UdrinkConnectionString %>" 
        
        
        
        
        SelectCommand="SELECT TB_Order_Category.Order_Category_ID, TB_Order_Category.Order_Category_Name + ' ราคา : ' + convert(nvarchar(255),TB_Product_Price.Price) AS Order_Category_Name FROM TB_Product INNER JOIN TB_Order_Category ON TB_Product.Product_ID = TB_Order_Category.Product_ID INNER JOIN TB_Product_Price ON TB_Product.Product_ID = TB_Product_Price.Product_ID AND TB_Order_Category.Order_Category_ID = TB_Product_Price.Order_Category_ID WHERE (TB_Product.Product_ID = @Product_ID)
">
        <SelectParameters>
            <asp:Parameter Name="Product_ID" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlPriceUnit" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DB_UdrinkConnectionString %>" 
        
        
        
        
        
        
        SelectCommand="SELECT TB_Product_Price.ID_Price, TB_Product_Price.Price FROM TB_Product_Price INNER JOIN TB_Order_Category ON TB_Product_Price.Order_Category_ID = TB_Order_Category.Order_Category_ID WHERE (TB_Product_Price.Order_Category_ID = @Order_Category_ID)">
        <SelectParameters>
             <asp:Parameter Name="Order_Category_ID" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="sqlOrderCateory" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DB_UdrinkConnectionString %>" 
        
        
        SelectCommand="SELECT [Order_Category_ID], [Order_Category_Name] FROM [TB_Order_Category]">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="sqlPriceUnitAll" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DB_UdrinkConnectionString %>" 
        
        SelectCommand="SELECT [ID_Price], [Price] FROM [TB_Product_Price] ORDER BY [ID_Price]">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlProductAll" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DB_UdrinkConnectionString %>" 
        SelectCommand="SELECT [Product_ID], [Product_Name], [Product_Category_ID], [Product_Unit], [In_Stock] FROM [TB_Product]">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlOrderCateAll" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DB_UdrinkConnectionString %>" 
        SelectCommand="SELECT [Order_Category_ID], [Order_Category_Name] FROM [TB_Order_Category]">
    </asp:SqlDataSource>
    </asp:Content>
